{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "# refer to docs to install textblob locally: https://pypi.python.org/pypi/textblob\n",
    "# https://textblob.readthedocs.io/en/dev/quickstart.html#sentiment-analysis\n",
    "from textblob import TextBlob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>listing_id</th>\n",
       "      <th>id</th>\n",
       "      <th>date</th>\n",
       "      <th>reviewer_id</th>\n",
       "      <th>reviewer_name</th>\n",
       "      <th>comments</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1180670</td>\n",
       "      <td>14705995</td>\n",
       "      <td>2014-06-24</td>\n",
       "      <td>10875598</td>\n",
       "      <td>Gregory</td>\n",
       "      <td>Ok, if you like the location and don't mind an...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4457617</td>\n",
       "      <td>24432844</td>\n",
       "      <td>2014-12-28</td>\n",
       "      <td>24502047</td>\n",
       "      <td>Amber</td>\n",
       "      <td>Kleine süße WG, super gelegen, sehr freundlich...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>722394</td>\n",
       "      <td>9248781</td>\n",
       "      <td>2013-12-16</td>\n",
       "      <td>6821360</td>\n",
       "      <td>Giri</td>\n",
       "      <td>Extremely disappointed.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4074444</td>\n",
       "      <td>23983183</td>\n",
       "      <td>2014-12-15</td>\n",
       "      <td>8822691</td>\n",
       "      <td>Wendy</td>\n",
       "      <td>Exactly as described.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>68046</td>\n",
       "      <td>11797670</td>\n",
       "      <td>2014-04-15</td>\n",
       "      <td>12231047</td>\n",
       "      <td>Virginie</td>\n",
       "      <td>Appartement très sympa, accueillant. A quelque...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>68774</td>\n",
       "      <td>23987149</td>\n",
       "      <td>2014-12-15</td>\n",
       "      <td>23170531</td>\n",
       "      <td>Anthony</td>\n",
       "      <td>The reservation was canceled the day before ar...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>920951</td>\n",
       "      <td>16985911</td>\n",
       "      <td>2014-08-05</td>\n",
       "      <td>16614692</td>\n",
       "      <td>Anthony</td>\n",
       "      <td>Very Nice and comfortable. Great location - Ma...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>462454</td>\n",
       "      <td>13159495</td>\n",
       "      <td>2014-05-20</td>\n",
       "      <td>14129237</td>\n",
       "      <td>Amanda</td>\n",
       "      <td>Sunserae was a phenomenal host. Incredible loc...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2207015</td>\n",
       "      <td>13088178</td>\n",
       "      <td>2014-05-19</td>\n",
       "      <td>14336410</td>\n",
       "      <td>Laurie</td>\n",
       "      <td>Our rental was great. It was just as described...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1773664</td>\n",
       "      <td>11945863</td>\n",
       "      <td>2014-04-20</td>\n",
       "      <td>9979725</td>\n",
       "      <td>Eric</td>\n",
       "      <td>fantastique\\ndavid simply the best !</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   listing_id        id        date  reviewer_id reviewer_name  \\\n",
       "0     1180670  14705995  2014-06-24     10875598       Gregory   \n",
       "1     4457617  24432844  2014-12-28     24502047         Amber   \n",
       "2      722394   9248781  2013-12-16      6821360          Giri   \n",
       "3     4074444  23983183  2014-12-15      8822691         Wendy   \n",
       "4       68046  11797670  2014-04-15     12231047      Virginie   \n",
       "5       68774  23987149  2014-12-15     23170531       Anthony   \n",
       "6      920951  16985911  2014-08-05     16614692       Anthony   \n",
       "7      462454  13159495  2014-05-20     14129237        Amanda   \n",
       "8     2207015  13088178  2014-05-19     14336410        Laurie   \n",
       "9     1773664  11945863  2014-04-20      9979725          Eric   \n",
       "\n",
       "                                            comments  \n",
       "0  Ok, if you like the location and don't mind an...  \n",
       "1  Kleine süße WG, super gelegen, sehr freundlich...  \n",
       "2                            Extremely disappointed.  \n",
       "3                              Exactly as described.  \n",
       "4  Appartement très sympa, accueillant. A quelque...  \n",
       "5  The reservation was canceled the day before ar...  \n",
       "6  Very Nice and comfortable. Great location - Ma...  \n",
       "7  Sunserae was a phenomenal host. Incredible loc...  \n",
       "8  Our rental was great. It was just as described...  \n",
       "9               fantastique\\ndavid simply the best !  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "## read in dataset\n",
    "data = pd.read_csv('../datasets/reviews.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>listing_id</th>\n",
       "      <th>id</th>\n",
       "      <th>date</th>\n",
       "      <th>reviewer_id</th>\n",
       "      <th>reviewer_name</th>\n",
       "      <th>comments</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1180670</td>\n",
       "      <td>14705995</td>\n",
       "      <td>2014-06-24</td>\n",
       "      <td>10875598</td>\n",
       "      <td>Gregory</td>\n",
       "      <td>Ok, if you like the location and don't mind an...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4457617</td>\n",
       "      <td>24432844</td>\n",
       "      <td>2014-12-28</td>\n",
       "      <td>24502047</td>\n",
       "      <td>Amber</td>\n",
       "      <td>Kleine süße WG, super gelegen, sehr freundlich...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>722394</td>\n",
       "      <td>9248781</td>\n",
       "      <td>2013-12-16</td>\n",
       "      <td>6821360</td>\n",
       "      <td>Giri</td>\n",
       "      <td>Extremely disappointed.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4074444</td>\n",
       "      <td>23983183</td>\n",
       "      <td>2014-12-15</td>\n",
       "      <td>8822691</td>\n",
       "      <td>Wendy</td>\n",
       "      <td>Exactly as described.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>68046</td>\n",
       "      <td>11797670</td>\n",
       "      <td>2014-04-15</td>\n",
       "      <td>12231047</td>\n",
       "      <td>Virginie</td>\n",
       "      <td>Appartement très sympa, accueillant. A quelque...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>68774</td>\n",
       "      <td>23987149</td>\n",
       "      <td>2014-12-15</td>\n",
       "      <td>23170531</td>\n",
       "      <td>Anthony</td>\n",
       "      <td>The reservation was canceled the day before ar...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>920951</td>\n",
       "      <td>16985911</td>\n",
       "      <td>2014-08-05</td>\n",
       "      <td>16614692</td>\n",
       "      <td>Anthony</td>\n",
       "      <td>Very Nice and comfortable. Great location - Ma...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>462454</td>\n",
       "      <td>13159495</td>\n",
       "      <td>2014-05-20</td>\n",
       "      <td>14129237</td>\n",
       "      <td>Amanda</td>\n",
       "      <td>Sunserae was a phenomenal host. Incredible loc...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2207015</td>\n",
       "      <td>13088178</td>\n",
       "      <td>2014-05-19</td>\n",
       "      <td>14336410</td>\n",
       "      <td>Laurie</td>\n",
       "      <td>Our rental was great. It was just as described...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1773664</td>\n",
       "      <td>11945863</td>\n",
       "      <td>2014-04-20</td>\n",
       "      <td>9979725</td>\n",
       "      <td>Eric</td>\n",
       "      <td>fantastique\\ndavid simply the best !</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   listing_id        id        date  reviewer_id reviewer_name  \\\n",
       "0     1180670  14705995  2014-06-24     10875598       Gregory   \n",
       "1     4457617  24432844  2014-12-28     24502047         Amber   \n",
       "2      722394   9248781  2013-12-16      6821360          Giri   \n",
       "3     4074444  23983183  2014-12-15      8822691         Wendy   \n",
       "4       68046  11797670  2014-04-15     12231047      Virginie   \n",
       "5       68774  23987149  2014-12-15     23170531       Anthony   \n",
       "6      920951  16985911  2014-08-05     16614692       Anthony   \n",
       "7      462454  13159495  2014-05-20     14129237        Amanda   \n",
       "8     2207015  13088178  2014-05-19     14336410        Laurie   \n",
       "9     1773664  11945863  2014-04-20      9979725          Eric   \n",
       "\n",
       "                                            comments  \n",
       "0  Ok, if you like the location and don't mind an...  \n",
       "1  Kleine süße WG, super gelegen, sehr freundlich...  \n",
       "2                            Extremely disappointed.  \n",
       "3                              Exactly as described.  \n",
       "4  Appartement très sympa, accueillant. A quelque...  \n",
       "5  The reservation was canceled the day before ar...  \n",
       "6  Very Nice and comfortable. Great location - Ma...  \n",
       "7  Sunserae was a phenomenal host. Incredible loc...  \n",
       "8  Our rental was great. It was just as described...  \n",
       "9               fantastique\\ndavid simply the best !  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head(n=10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
